package com.stone.design.patterns.state;

/**
 * @author Stone
 * @version V1.0
 * @description:
 * @date 4/25/18 22:05
 * @email redsstone@163.com
 */
public class HasQuarterState implements State{

    GumballMachine mGumballMachine;

    public HasQuarterState(GumballMachine gumballMachine) {
        mGumballMachine = gumballMachine;
    }

    @Override
    public void insertQuarter() {
        System.out.println("has quarter,needn't insert");
    }

    @Override
    public void ejectQuarter() {
        System.out.println("quarter turned....");
        mGumballMachine.setState(mGumballMachine.getNoQuarterState());
    }

    @Override
    public void tumCrank() {
        System.out.println("you turned.....");
        mGumballMachine.setState(mGumballMachine.getSoldState());
    }

    @Override
    public void dispense() {
        System.out.println("no gumball dispense");
    }
}
